package com.molyfun.parents.activity.report.plan;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.molyfun.parents.R;
import com.molyfun.parents.activity.common.BaseActivity;
import com.molyfun.parents.activity.common.attachment.AttachmentViewer;
import com.molyfun.parents.rest.bean.PlanDetailResponse;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * 2017/12/21/15点28分
 * 此页面弃用
 */
public class FieldDetailActivity extends BaseActivity implements View.OnClickListener {

    @InjectView(R.id.base_title_left)
    ImageView mTitleBack;
    @InjectView(R.id.field_name)
    TextView mFieldName;
    @InjectView(R.id.layout_target_list)
    LinearLayout mTargetListContainer;

    private PlanDetailResponse.PlanDetailBean.FieldlistBean mFieldlistBean;

    public static void startActivity(Context context, PlanDetailResponse.PlanDetailBean.FieldlistBean fieldlistBean) {
        Intent intent = new Intent();
        intent.putExtra("fieldListbean", fieldlistBean);
        intent.setClass(context, FieldDetailActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_field_detail);
        ButterKnife.inject(this);

        getSupportActionBar().setTitle("");

        mTitleBack.setOnClickListener(this);

//        mFieldlistBean = getIntent().getParcelableExtra("fieldListbean");


        if (mFieldlistBean != null) {
            mFieldName.setText("领域：" + mFieldlistBean.getFieldtempname());
           /* if(mFieldlistBean.getTargetlist() != null && mFieldlistBean.getTargetlist().size() > 0){
                for(PlanDetailResponse.TargetlistBean targetlistBean : mFieldlistBean.getTargetlist()){
                    LinearLayout fieldView = (LinearLayout) LayoutInflater.from(FieldDetailActivity.this).inflate(R.layout.view_field_target_cell, null, false);
                    ((TextView)fieldView.findViewById(R.id.target_name)).setText(targetlistBean.getTargettraining());
                    if(targetlistBean.getMediaobjectlist() == null || targetlistBean.getMediaobjectlist().size() == 0){
                        (fieldView.findViewById(R.id.attachment_view)).setVisibility(View.GONE);
                    }else{
                        ((AttachmentViewer)fieldView.findViewById(R.id.attachment_view)).initData(targetlistBean.getMediaobjectlist());
                    }
                    mTargetListContainer.addView(fieldView);
                }
            }*/
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.base_title_left:
                finish();
                break;
        }
    }


}
